<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
    //以上获取的是绝对路径 如 http://localhost:8888/xxx 或http://localhost:8888
    request.setAttribute("ctx",basePath);
%>